﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

public class cGlobal : System.Web.UI.Page
{
    public cGlobal()
    {
    }

    /// <summary>
    /// Declaraciones Globales del Web Site
    /// </summary>
    #region Declaraciones
    public string sqlConnect = ConfigurationManager.ConnectionStrings["EDINAVIERAS"].ToString();
    public int idAplicacion = int.Parse(ConfigurationManager.AppSettings["IDAPLICACION"].ToString());
    public cJavaScript objJavaScript = new cJavaScript();
    public ObelixTI.Seguridad objSeguridad = new ObelixTI.Seguridad(ConfigurationManager.ConnectionStrings["EDINAVIERAS"].ToString());
    public ObelixTI.Plantilla objPlantilla = new ObelixTI.Plantilla(ConfigurationManager.ConnectionStrings["EDINAVIERAS"].ToString());

    #endregion

    #region Propiedades

    public int idUsuario
    {
        get
        {
            if (Session["IDUSUARIO"] != null)
                return (int)Session["IDUSUARIO"];

            return 0;
        }
        set { Session["IDUSUARIO"] = value; }
    }

    public string nombreUsuario
    {
        get
        {
            if (Session["NOMBREUSUARIO"] != null)
                return (string)Session["NOMBREUSUARIO"];

            return null;
        }
        set { Session["NOMBREUSUARIO"] = value; }
    }

    #endregion


    public Boolean DropDownFill(DropDownList ddl, DataTable dtt, string DataTextField, string DataValueField, string addItem, string valueItem)
    {
        ddl.DataSource = dtt.DefaultView;
        ddl.DataValueField = DataValueField;
        ddl.DataTextField = DataTextField;
        ddl.DataBind();
        ddl.Items.Insert(0, addItem);
        ddl.Items[0].Value = valueItem;
        ddl.SelectedIndex = 0;
        return true;
    }

    public enum Estado
    {
        SALIDA_SPRB = 0,
        ENTRADA_BODEGA,
        SALIDA_BODEGA,
        ENTRADA_SPRB
    }
}